package com.mes.basicdata.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.common.domain.BasicModel;

/**
 * <p>
 * 
 * </p>
 * 
 * <p>
 * Created on 2017-03-19
 * </p>
 * 
 * @author lcs
 * 
 */
@Entity()
//@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "B_XBOM_HEADER")
@BatchSize(size=10)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Xbom extends BasicModel implements java.io.Serializable {
	
	@Id
	@GenericGenerator(name = "xbomUid", strategy = "assigned")
	@Column(name="XBOMUID",length=50)
	protected String xbomUid;
	
	@Column(name="XBOM_NAME",length=50)
	protected String xbomName;
	
	@Column(name="XBOM_TYPE",length=50)
	protected String xbomType;
	
	@Column(name="XBOM_STATE",length=50)
	protected String xbomState;
	
	@Column(name="PART_NUMBER",length=50)
	protected String partUid;
	
	//many-to-one
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PART_NUMBER",insertable=false,updatable=false)
	protected Part part;
	
	@Column(name="PARA_DEPTUID",length=50)
	protected String deptUid;
	public final static String XBOMTYPE_MISSING_PART = "611";
	public final static String XBOMTYPE_MRP_PART = "100";
	/**
	 * 动态生成xbom的表达式
	 */
	@Column(name="PARA_EXPR",length=50)
	protected String paraExpr;
	
	@Transient
	protected String createType;//bom创建类型

	

	public String getXbomUid() {
		return xbomUid;
	}

	public void setXbomUid(String xbomUid) {
		this.xbomUid = xbomUid;
	}

	public String getXbomName() {
		return xbomName;
	}

	public void setXbomName(String xbomName) {
		this.xbomName = xbomName;
	}

	public String getXbomType() {
		return xbomType;
	}

	public void setXbomType(String xbomType) {
		this.xbomType = xbomType;
	}

	public String getXbomState() {
		return xbomState;
	}

	public void setXbomState(String xbomState) {
		this.xbomState = xbomState;
	}

	public String getPartUid() {
		return partUid;
	}

	public void setPartUid(String partUid) {
		this.partUid = partUid;
	}

	public String getParaExpr() {
		return paraExpr;
	}

	public void setParaExpr(String paraExpr) {
		this.paraExpr = paraExpr;
	}

	public String getCreateType() {
		return createType;
	}

	public void setCreateType(String createType) {
		this.createType = createType;
	}

	public String getDeptUid() {
		return deptUid;
	}

	public void setDeptUid(String deptUid) {
		this.deptUid = deptUid;
	}

	@Override
	public String getUuid() {
		return this.getXbomUid();
	}

	@Override
	public void setUuid(String uuid) {
		this.setXbomUid(uuid);
	}

	public Part getPart() {
		return part;
	}

	public void setPart(Part part) {
		this.part = part;
	}
	
	

}